#!/bin/bash

echo "----------------配置ssh-------------------------"
sudo apt install -y git wget dos2unix
if [ ! -d "$HOME/.ssh" ]; then
    mkdir $HOME/.ssh
fi
wget https://gitee.com/kduant/vimrc/raw/master/.ssh/id_rsa -P $HOME/.ssh
wget https://gitee.com/kduant/vimrc/raw/master/.ssh/id_rsa.pub -P $HOME/.ssh
chmod 600 $HOME/.ssh/id_rsa
chmod 600 $HOME/.ssh/id_rsa.pub

# git配置
echo "--------------------配置git选项-----------------------"
git config --global user.email "wangjun850725@163.com"
git config --global user.name "kdurant"
git config --global core.autocrlf input
git config --global core.editor nvim
git config --global http.sslVerify "false"
git config --global http.postBuffer 1048576000

git config --global alias.st "status"
git config --global alias.br "branch"
git config --global alias.lo "log --graph --pretty=oneline"
git config --global alias.cm "commit -m"
git config --global alias.co "checkout"

git config --global --add safe.directory "*"

LAZYGIT_VERSION=$(curl -s "https://api.github.com/repos/jesseduffield/lazygit/releases/latest" | grep -Po '"tag_name": "v\K[^"]*')
curl -Lo lazygit.tar.gz "https://github.com/jesseduffield/lazygit/releases/latest/download/lazygit_${LAZYGIT_VERSION}_Linux_x86_64.tar.gz"
tar xf lazygit.tar.gz lazygit
sudo install lazygit /usr/local/bin
